package com.JavaTest8;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Car implements Serializable {
    private int car_Id;
    private double car_Price;
    private String car_brand, car_Color, car_Type;
    private Date car_PublishDate;
    private static int ID = 10000;

    {
        ID ++ ;
    }


    public Car(){}

    public Car(double p, String b, String c, String t, String date){
        this.car_Id = ID;
        this.car_brand = b;
        this.car_Color = c;
        this.car_Price = p;
        this.car_Type = t;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        try{
            this.car_PublishDate = sdf.parse(date);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    public String toString() {
        return "Car{" +
                "car_Id=" + car_Id +
                ", car_Price=" + car_Price +
                ", car_brand='" + car_brand + '\'' +
                ", car_Color='" + car_Color + '\'' +
                ", car_Type='" + car_Type + '\'' +
                ", car_PublishDate=" + car_PublishDate +
                '}';
    }

    public int getCar_Id() {
        return car_Id;
    }

    public double getCar_Price() {
        return car_Price;
    }

    public void setCar_Price(double car_Price) {
        this.car_Price = car_Price;
    }

    public String getCar_brand() {
        return car_brand;
    }

    public void setCar_brand(String car_brand) {
        this.car_brand = car_brand;
    }

    public String getCar_Color() {
        return car_Color;
    }

    public void setCar_Color(String car_Color) {
        this.car_Color = car_Color;
    }

    public String getCar_Type() {
        return car_Type;
    }

    public void setCar_Type(String car_Type) {
        this.car_Type = car_Type;
    }

    public Date getCar_PublishDate() {
        return car_PublishDate;
    }

    public void setCar_PublishDate(Date car_PublishDate) {
        this.car_PublishDate = car_PublishDate;
    }

}
